<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:sec="http://www.springframework.org/security/facelets/tags"
      >
    <body>
        <ui:composition>
            <div class="menuLinks">
                <h:form>
                    <sec:ifAllGranted roles="ROLE_USER"> 
                        <a styleClass ="menuLink" href="#{facesContext.externalContext.requestContextPath}/j_spring_security_logout">Logout</a>

                    </sec:ifAllGranted>
                    <sec:ifAllGranted roles="ROLE_ANONYMOUS"> 
                        <p:commandLink styleClass ="menuLink" action="login" value="Login"/>
                        <p:commandLink styleClass ="menuLink" action="registration" value="Registration"/> 
                   </sec:ifAllGranted>
                                        
                    |
                    <p:commandLink styleClass ="menuLink" action="userTasks" value="My Tasks" ajax="false"/>
                    |
                    <p:commandLink styleClass ="menuLink" action="policy" value="Policy"/>
                    |
                    <sec:ifAllGranted roles="ROLE_ADMIN">
                        <p:commandLink styleClass ="menuLink" action="admin" value="Users"/>
                    |    
                    </sec:ifAllGranted>
                    
                    <sec:ifAllGranted roles="ROLE_ADMIN">
                        <p:commandLink styleClass ="menuLink" action="stats" value="Statistics"/>
                    </sec:ifAllGranted>
                    

                </h:form>
            </div>

            <div class="menuBTs">
                <h:form>  
                    <p:growl id="messages" showDetail="true" />  
                    <p:menubar> 
                        <p:menuitem styleClass="menuBT" value="About Project" id="menuBT1"/>

                        <p:menuitem styleClass="menuBT" value="Technical Information" update="messages" 
                                    action="index" id="menuBT3"/>
                        <p:menuitem styleClass="menuBT" value="Algorithms" update="messages" 
                                    action="index" id="menuBT4"/>

                        <p:submenu  styleClass="menuBT" label="Use Factory">
                            <p:submenu label="Demonstrative"> 
                                <p:menuitem value="Sort" update="messages" action="#{factoryBackingBean.chosenSort}" ajax="false"/> 
                                <p:separator /> 
                                <p:menuitem value="Fibonacci" update="messages" action="#{factoryBackingBean.chosenFibb}" ajax="false"/>
                                <p:separator /> 
                                <p:menuitem value="Eratosthenes" update="messages" action="#{factoryBackingBean.chosenEratosthenes}" ajax="false"/> 
                            </p:submenu>

                            <p:separator />  
                            <p:submenu label="Polynomial">
                                <p:menuitem value="Shortest path" update="messages" action="#{factoryBackingBean.chosenShortestpath}" ajax="false"/> 
                                <p:separator /> 
                                <p:menuitem value="Spanning Tree" update="messages" action="#{factoryBackingBean.chosenSpanningTree}" ajax="false"/>
                                <p:separator/>
                                <p:menuitem value="Topological Order" update="messages" action="#{factoryBackingBean.chosenTopologicalOrder}" ajax="false"/>
                                <p:separator />

                            </p:submenu>
                            <p:separator /> 
                            <p:submenu label="Non Polynomial">
                                <p:menuitem value="Traveling salesman" update="messages" action="#{factoryBackingBean.chosenTSP}" ajax="false"/> 
                            </p:submenu>    
                        </p:submenu>         

                    </p:menubar> 
                </h:form>  
            </div>
        </ui:composition>
    </body>
</html>